#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author:余振新
@file: read_yaml.py
@time: 2020/01/16
"""
import yaml

from common.path import ensure_path_sep


def read_yaml(yaml_file_name=None):
    if yaml_file_name is None:
        file_name = ensure_path_sep("/test_data/testdata.yml")
    else:
        file_name = ensure_path_sep(yaml_file_name)
    f = open(file_name, "r", encoding='utf-8')
    data = yaml.load(f, Loader=yaml.FullLoader)
    f.close()
    return data


if __name__ == "__main__":
    a=read_yaml()
    # print(ReadYaml.read_yaml()["login1"]["username"])
    # readyaml.read_yaml_all()
    # readyaml.read_yaml_dump()
    # readyaml.read_yaml_list()
    print(read_yaml())
    print(read_yaml()["login"][0])
    print(read_yaml()["meeting"]["text"])
    print(ensure_path_sep(read_yaml()["meeting"]["pdf_path"]))


